JavaScript

listObj.getAllErrors Method

Syntax

var errorObj = listObj.getAllErrors();

Returns

errorObjJSON Array

Returns an array of objects containing all errors that occurred when synchronizing the List. One object is created for each error. If no errors occurred, the array will be empty. Each object in the array has the following properties:

errorTypeString

The type of error. Can be 'writeConflict', 'serverSide', or 'globalError'.

pathString

The 'path' to get to the row that had the error. If the error was in a child List, the path wil indicate how to navigate to the child row.

errorArray

An array of error information.

Description

Returns all errors that occurred when synchronizing a List.

Discussion

When you synchronize a List, the List and all of it children are synchronized (you can't synchronize a child List independently of its parent). Errors could have occurred in the parent List, or in any of the parent List's child Lists. The getAllErrors() method can be called to get a list of all the errors that occurred during synchronization.

This method an be called after a List has been synchronized to get an array of all of the errors that occurred (which would have prevented a record from being synchronized). Only applies to Lists that have a Detail View.

var listObj = {dialog.object}.getControl('list1');

if (listObj) {
    var err = listObj.getAllErrors();
    alert(JSON.stringify(err));
}

Understanding the Path Property

The Path property is an array object that contains information on how to navigate to the row in the List that has the error. If the error occurred in the parent record, then the Path array has a single entry - the row (zero based) number of the record with error. For example, the Path property might be [3], indicating that the error occurred on the 4th row in the List.

If the error occurred on a child List, then the Path array tells you how to find the row with the error. For example, say that the parent List has a child List called Orders, which in turn has a child List called OrderItems. If an error occurred on the 3rd OrderItems record for the 2nd Orders record for the 3 parent record, the Path array will look like this:

[2,'__LIST__ORDERS',1,'__LIST__ORDERITEMS',2]

The Error Object

In the case of a 'writeConflict' error, the error object will contain an array of objects, with items in the array for each write conflict error that was detected.

Each object in the array will have these properties:

Property
Description
varName

The name of the control in the List's detail view where the user made the edit.

fieldName

The field name in the List that has the error.

oldValue

The value that was in this field when the List was originally populated.

oldValueCurrent

The value that is currently in this field on the database (it is because this value no longer matches oldValue that a write conflict is being reported).

newValue

The value that the user entered for this field (this is the value that was attempted to be written to the database)

In the case of a 'serverSide' error, the error, the error object is an array of objects. Each object contains a validation error. The array can have multiple entries because there could be multiple validation errors for a field.

Each item in the array has these properties:

Property
Description
errorText

The error message returned by the validation rule.

varName

The error message returned by the validation rule

Limitations

List Control with a Detail View Only